<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="com.cap.bts.framework.usermgnt.constant.EmployeeStatus"%>    
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>编辑会员卡配送信息</title>
<%@include file="../include/include.jsp"%>
<link rel="stylesheet" type="text/css" href="${csspath }/public.css"/>
<link rel="stylesheet" type="text/css" href="${csspath }/datepicker.css"/>
<link rel="stylesheet" type="text/css" href="${csspath }/style_l.css"/>
<script type="text/javascript" src="${jspath }/jquery-1.4.4.js"></script>
<script type="text/javascript" src="${jspath }/jquery.ui.min.js"></script>
<script type="text/javascript" src="${jspath }/ui.datepicker_zh-CN.js"></script>
<script type="text/javascript" src="${jspath }/jquery.blockUI.js"></script>
<script type="text/javascript" src="${jspath }/public.js"></script>
<script type="text/javascript" src="${jspath }/jquery.selectAll.js"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.ui.draggable.js"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.alerts.js"></script>
<script type="text/javascript" src="${jspath}/load_layer.js"></script>
<link rel="stylesheet" type="text/css" href="${csspath}/jquery.alerts.css" />

<link rel="stylesheet" type="text/css"
	href="${webcontext}/css/validationEngine.jquery.css" />
<script src="${jspath}/jquery/validate/jquery.validationEngine.js"
	type="text/javascript"></script>
<script src="${jspath}/jquery/validate/jquery.validationEngine-zh.js"
	type="text/javascript"></script>
	<script type="text/javascript"
	src="${webcontext}/javascript/jquery/jquery.ui.draggable.js"></script>
<style type="text/css">
.formError .formErrorContent {
    -moz-border-radius: 6px 6px 6px 6px;
    -moz-box-shadow: 0 0 6px #000000;
    background: none repeat scroll 0 0 #EE0101;
    border: 2px solid #DDDDDD;
    color: #FFFFFF;
    font-family: tahoma;
    font-size: 11px;
    padding: 4px 10px;
    width: 100px;
}
</style>

<script type="text/javascript">
var myHeight = 0;
$(function(){
	
	$("#search_form").validationEngine(
			{
             promptPosition:"topLeft",
             success:false,
             validationEventTriggers:"blur",
             scroll : false,
			 failure:function(){} 
	});
	if("${flag}" == "canNotUpdate"){
		jAlert('商品库存不足，更新失败。', '提示');
	}
	if("${flag}" == "tooLate"){
		jAlert('发货时间不得早于当前时间。', '提示');
	}
	
});

function check(){
	var shipAmount = document.getElementById("shipAmount").value;
	var estimatedArriveDate = $("#estimatedArriveDate").val();
	var reg=/^[0-9]+$/;
	if ((!reg.test(shipAmount))||(parseInt(shipAmount)==0)){
		jAlert('接收数量必须为正整数', '提示');
		return false;
	} 
	var shipDate = $("#shipDate").val();
	var estimatedArriveDate = $("#estimatedArriveDate").val();
	var startD = new Date(Date.parse(shipDate.replace(/-/g,"/")));
	var endD   = new Date(Date.parse(estimatedArriveDate.replace(/-/g,"/")));
	var days = parseInt((endD.getTime()-startD.getTime()) / (1000 * 60 * 60 * 24));
	if(shipDate == "" || shipDate == undefined || shipDate == null){
		jAlert('请输入发货时间', '提示');
		return false;
	}
	if(estimatedArriveDate == "" || estimatedArriveDate == undefined || estimatedArriveDate == null){
		jAlert('请输入预计到货时间', '提示');
		return false;
	}
	if(!(estimatedArriveDate == "" || estimatedArriveDate == undefined || estimatedArriveDate == null)){
		if(days < 0){
			jAlert('预计到货日期不得早于发货日期', '提示');
			return false;
		}
	}
	return true;
	}
function update() {
	if(check()){
		info_form.action="${webcontext}/crmdp/dealer/logistic/toUpdateLogisitcPage";
		document.getElementById("info_form").submit();
	}
}
function backToSearch(){
	info_form.action="${webcontext}/crmdp/dealer/logistic/backToLogisitcPage";
	document.getElementById("info_form").submit();
}

</script> 
</head>
<body>
			<!-- content -->
	<div id="content">
		    <div class="spliter h_5"></div>
			<div class="page_info">
			</div>
			          <div class="spliter h_5"></div>
		<!-- wrap -->
		<div id="wrap">
			<!-- info_div -->
	<form:form id="info_form" method="post" modelAttribute="dto">
		<input type="hidden" name="id" value="${dto.id}" /><br></br>
		门店编号：&nbsp;${dto.dealerNo}<br></br>
		订单编号：&nbsp;${dto.orderNo}<br></br>
		状态：&nbsp;&nbsp;&nbsp;在途<br></br>
		商品名称：&nbsp;${dto.cardName}
		<br></br>
		<hr align=center width=300 color=#987cb9 SIZE=1>
		<br>
		<span class="need">*</span>实发数量：<form:input path="shipAmount" value="${dto.shipAmount}" id="shipAmount"
		cssClass="validate[length[0,100]]  text string"/><br></br>
		<span class="need">*</span>发货日期：<form:input path="shipDate" id="shipDate" 
					  	cssClass="validate[custom[date]] text date" value="${dto.shipDate}"/><br></br>
		<span class="need">*</span>预计到货：<form:input path="estimatedArriveDate" id="estimatedArriveDate" 
					  	cssClass="validate[custom[date]] text date" value="${dto.estimatedArriveDate}"/><br></br>
		&nbsp;物流公司：<form:input path="expressCom" value="${dto.expressCom}"
		cssClass="validate[length[0,100]]  text string"/><br></br>
		&nbsp;物流单号：<form:input path="expressNo" value="${dto.expressNo}"
		cssClass="validate[length[0,100]]  text string"/><br></br>
		<hr align=center width=300 color=#987cb9 SIZE=1><br></br>
		<input type="button" class="ui_input_btn01" value="   更 新   " onclick="update()"/>&nbsp;&nbsp;
		<input type="reset" class="ui_input_btn01" value="   重 置   "/>&nbsp;&nbsp;
		<input type="button" class="ui_input_btn01" value="   取 消   " onclick="backToSearch();"/>	    
  </form:form>
		</div>
		<!-- /wrap -->
		</div>	
		<!-- /content -->
  </body>

</html>